#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QWidget>
#include <QWidget>
#include<QLabel>
#include<QLineEdit>
#include<QPushButton>
#include<QComboBox>
#include<QHBoxLayout>
#include<QVBoxLayout>
#include<QDebug>
#include<QFileDialog>
#include<QCameraInfo>
#include <QPainter>
#include"contrl/mycontrol.h"
#include <QTime>
#include<QMessageBox>
#include<QEvent>
#include <QMouseEvent>
#include <QCryptographicHash>
#include<QTimer>

#include"golob.h"

enum
{
    takePictrueWidget,//0
    playbackWidget,//1
    pictrueWidget,//2
    logWidget,//3
    transcodeWidget,//4
    setWidget,//5
    logInWidget//6
};

class LoginWidget : public QWidget
{
    Q_OBJECT
public:
    explicit LoginWidget(QWidget *parent = nullptr);

    void initUI();
    void createCode();

    QString md5Encrypt(const QString&passwd);

    int getUser_id() const;
    void setUser_id(int value);

    int getIndex() const;
    void setIndex(int value);

    QString getPolice_num() const;
    void setPolice_num(const QString &value);

signals:


    void LoginToRet(int sign);

    void RetToMain();
public slots:


    //密码明文密文切换
    void passwdChange();
    //刷新验证码
    void refreshCaptcha();

    void isLoginFinished();


    void sendCancelClicked();



private:
    QLabel*title;
    QLabel*deviceNum;
    QLabel*policeNum;
    QLabel*password;
    QLabel*verifeCode;

    //验证码
    QLabel*Codepicture;
    QPixmap*image;
    QString code;

    QLineEdit*deviceNum_edit;
    QLineEdit*policeNum_edit;
    QLineEdit*password_edit;
    QLineEdit*verifeCode_edit;


    QComboBox*device_box;

    QPushButton*password_box;
    QPushButton*ensure;
    QPushButton*cancel;

    QHBoxLayout*layout_H1;
    QHBoxLayout*layout_H2;
    QHBoxLayout*layout_H3;
    QHBoxLayout*layout_H4;
    QHBoxLayout*layout_H5;
    QHBoxLayout*layout_H6;

    QVBoxLayout*layout_V;


    //数据库操作
    MyControl* con;
    BaseModel*model;



    int index=0;

    QTimer *time;

    int user_id;
    QString police_num;

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;


};

#endif // LOGINWIDGET_H
